﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BASE;



public partial class Admin_dstin : System.Web.UI.Page
{
    public int cout = 1;
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Utils.getStringSession("userid") == "")
        {
            Response.Redirect("/admin/login.aspx");
        }
        dr_lt.SelectedIndexChanged += new EventHandler(dr_lt_SelectedIndexChanged);
        if (!IsPostBack)
        {
            binLoaiTin();
            busTin busT = new busTin();
            List<entTin> lst = new List<entTin>();
            lst = busT.getTinByLoaiTinId(int.Parse(dr_lt.SelectedValue));
            gr_tin.DataSource = lst;
            gr_tin.DataBind();
        }
    }

    void dr_lt_SelectedIndexChanged(object sender, EventArgs e)
    {
        busTin busT = new busTin();
        List<entTin> lst = new List<entTin>();
        lst = busT.getTinByLoaiTinId(int.Parse(dr_lt.SelectedValue));
        gr_tin.DataSource = lst;
        gr_tin.DataBind();
    }
    void binLoaiTin()
    {
        busLoaiTin busLT = new busLoaiTin();
        dr_lt.DataSource = busLT.getAll();
        dr_lt.DataTextField = "TenLoaiTin";
        dr_lt.DataValueField = "LoaiTinId";
        dr_lt.DataBind();
    }
}